solving the konigsberg bridge problem in python